<div class="account-menu">
    <?php foreach($second_site_list as $second_site){?>
        <h2 <?php if($second_site['id'] == $site['parent_id']){?>class="selected"<?php }?> ><a href="javascript:void(0);"><?php echo $second_site['title']?></a></h2>
        <?php if(count($third_site_lists)){?>
            <ul class="account-submenu">
                <?php foreach($third_site_lists as $second_site_url => $third_site_list){?>
                    <?php if($second_site_url == $second_site['url']){?>
                        <?php foreach($third_site_list as $third_site){?>
                            <li <?php if($third_site['url'] == $third_url){?>class="current"<?php }?> >
                                <a href="/site/help/<?php echo $second_site['url']?>/<?php echo $third_site['url']?>.html"><?php echo $third_site['title']?></a>
                            </li>
                        <?php }?>
                    <?php }?>
                <?php }?>
            </ul>
        <?php }?>
    <?php }?>
</div>

<script type="text/javascript">
    $(document).ready(function(){
        $(".account-menu ul").hide();
        var h2 = $(".account-menu h2");
        var currentA = new Array();
        currentA  = $('.account-menu ul li');
        for(var i = 0; i<currentA.size();i++){
            if($($(currentA[i])).hasClass('current') == true) {
                $(currentA[i]).parent().show();
            }
        }
        h2.click(function(){
            $(".account-menu ul").slideUp();
            var current = $(this).next('ul');
            current.slideDown();
            h2.removeClass("selected");
            $(this).addClass("selected");
        });

    });
</script>